package org.spark.api.util.model;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
 * @author chenwy
 */
public final class HBaseTableMapping {

    private static final Map<Class, HBaseClassMapping> mappings = new ConcurrentHashMap<>();

    public static final void put(Class<?> clazz, HBaseColumnMapping[] columnFilters){
        HBaseClassMapping.Builder builder = HBaseClassMapping.builder();
        for(HBaseColumnMapping columnFilter : columnFilters){
           builder.put(new String(columnFilter.getFamily()) + new String(columnFilter.getQualifier()), columnFilter);
        }
        mappings.put(clazz, builder.build());
    }

    public static final HBaseClassMapping get(Class<?> clazz){
        return mappings.get(clazz);
    }

    public static final boolean containsKey(Class<?> clazz){
        return mappings.containsKey(clazz);
    }

}
